<template>
  <jl-base>
    <jl-header>
      <mt-header title="选择商品" :fixed="true">
        <i slot="left">
          <mt-button icon="back" @click="back"></mt-button>
        </i>
      </mt-header>
    </jl-header>

    <jl-content>
      <template v-for="item in list">
        <div class='jl_form' @click="checkedGood(item)">
          <div class='jl_form_item bor_bottom'>
                    <span class='w04 '>
                      {{item.GCSPBM}}
                    </span>
            <span class='w08 tr'>
                      {{item.GCSPMC}}
                    </span>
            <span class='w12 font_size_small'>
                      {{item.SL}}
                    </span>
            <i class='fa fa-angle-right'></i>
          </div>
        </div>
      </template>
    </jl-content>
  </jl-base>
</template>

<script>
  export default {
    name: "need-goods",
    props: {
      data: {type: Object},
      index: {type: Number}
    },
    data() {
      return {
        list: [],
      }
    },
    methods: {
      back() {
        this.$set(this.data, 'show', false);
        this.$emit('close')
      },
      checkedGood(item) {
        this.$emit('save', item, this.index);
        this.back();
      }
    },
    created() {
      return this.$engineer.searchNeedGood({
        'GCSPBM': this.data.GCSPBM
      })
        .then(v => {
          this.list = v
        })
    }
  }
</script>

<style scoped>

</style>
